package com.zhonghui.mapper;

import com.zhonghui.annotation.AutoFill;
import com.zhonghui.dto.PageDto;
import com.zhonghui.enumeration.OperationType;
import com.zhonghui.model.Product;
import com.zhonghui.model.ProductDetail;
import com.zhonghui.vo.BannerVo;
import com.zhonghui.vo.CategoryVo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.boot.Banner;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author: FL
 * @create: 2024 2024/5/3 14:54
 */
@Mapper
public interface ProductMapper {
    List<CategoryVo> selectCategoriesByParentId( Long parentId);
    /**
     * 获取商品分类
     */
    List<CategoryVo> getCategory();

    CategoryVo getCategoryById(Long categoryId);

    CategoryVo getCategoryByName(String categoryName);

    List<Product> getHot(PageDto pageDto);

    List<Product>  getAllProduct(PageDto pageDto);

    Product getProduct(Long id);

    ProductDetail getProductDetail(Long id);

    @AutoFill(value = OperationType.INSERT)
    Long addProduct(Product product);

    List<BannerVo> getBanner();

    @AutoFill(value = OperationType.INSERT)
    Integer addProductDetail(ProductDetail productDetail);

    Integer deleteProduct(@Param(value = "id")Long id);

    Integer deleteProductDetail(@Param(value = "id")Long id);

    List<Product> selectAllByParentCategoryId(Long parentCategoryId);

    List<Product> selectAllByCategoryId(Long categoryId);

    List<Product> searchByKeyword(String keyword);

    @AutoFill(value = OperationType.UPDATE)
    Integer updateProduct(Product product);

    @AutoFill(value = OperationType.UPDATE)
    Integer updateProductDetail(ProductDetail productDetail);




}
